package com.mes.schedule.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.JoinColumnOrFormula;
import org.hibernate.annotations.JoinColumnsOrFormulas;

import com.mes.common.domain.BasicModel;

/***
 * @author cswen
 * @Time 2017/3/15
 * @add Annotation cswen 2017/3/15
 */
/*
@Entity
@org.hibernate.annotations.Entity(dynamicInsert=false,dynamicUpdate=false)
@Table(name = "T_SCHEDULE_OVERTIME")
*/
public class ScheduleOverTime extends BasicModel  implements Serializable {
	
	@Column(name = "SCHEDULEUID")
	protected String scheduleUid;
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="SCHEDULEUID",insertable=false,updatable=false)
	protected  ScheduleScheme scheme;
	
	@Column(name = "TASKUID")
	protected String taskUid;
	
	@Column(name = "DRAWINGID")
	protected String drawingId;
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumnsOrFormulas(value={
			@JoinColumnOrFormula(column=@JoinColumn(name="SCHEDULEUID",referencedColumnName="ID",nullable=false,insertable=false,updatable=false)),
			@JoinColumnOrFormula(column=@JoinColumn(name="'TASKUID'", referencedColumnName="TYPESNAME",nullable=false,insertable=false,updatable=false))
	})
	protected SOperationTask operationTask;
	
	protected SPartTask partTask;
	
	@Column(name = "RESUID")
	protected String deviceUid;
	
	protected SDevice device;
	
	@Column(name = "OVERTIMESTART", length = 7)
	protected Date overTimeStart;
	
	@Column(name = "OVERTIMEFINISH", length = 7)
	protected Date overTimeFinish;
	
	@Column(name = "OVERTIMEWORK", precision = 20, scale = 0)
	protected double overTimeWork;

	public String getScheduleUid() {
		return scheduleUid;
	}

	public void setScheduleUid(String scheduleUid) {
		this.scheduleUid = scheduleUid;
	}

	public ScheduleScheme getScheme() {
		return scheme;
	}

	public void setScheme(ScheduleScheme scheme) {
		this.scheme = scheme;
	}

	public String getTaskUid() {
		return taskUid;
	}

	public void setTaskUid(String taskUid) {
		this.taskUid = taskUid;
	}

	public SOperationTask getOperationTask() {
		return operationTask;
	}

	public void setOperationTask(SOperationTask operationTask) {
		this.operationTask = operationTask;
	}

	public Date getOverTimeStart() {
		return overTimeStart;
	}

	public void setOverTimeStart(Date overTimeStart) {
		this.overTimeStart = overTimeStart;
	}

	public Date getOverTimeFinish() {
		return overTimeFinish;
	}

	public void setOverTimeFinish(Date overTimeFinish) {
		this.overTimeFinish = overTimeFinish;
	}

	public double getOverTimeWork() {
		return overTimeWork;
	}

	public void setOverTimeWork(double overTimeWork) {
		this.overTimeWork = overTimeWork;
	}

	public String getDeviceUid() {
		return deviceUid;
	}

	public void setDeviceUid(String deviceUid) {
		this.deviceUid = deviceUid;
	}

	public SDevice getDevice() {
		return device;
	}

	public void setDevice(SDevice device) {
		this.device = device;
	}

	/**
	 * @return the drawingId
	 */
	public String getDrawingId() {
		return drawingId;
	}

	/**
	 * @param drawingId the drawingId to set
	 */
	public void setDrawingId(String drawingId) {
		this.drawingId = drawingId;
	}
	
	/**
	 * @return the partTask
	 */
	public SPartTask getPartTask() {
		return this.operationTask.getParentTask();
	}

	/**
	 * @param partTask the partTask to set
	 */
	public void setPartTask(SPartTask partTask) {
		this.partTask = partTask;
	}



	


}
